Routines (alphabetical) > Routines: K > KEYWORD_SET

KEYWORD_SET

Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also

The KEYWORD_SET function returns a Boolean value based on the value of the specified expression. It returns a True (1) if its argument is defined and nonzero, and False (0) otherwise. The exact rules used to determine this are given in Return Value below.

Syntax

Result = KEYWORD_SET(Expression)

Return Value

This function returns True (1) if:

KEYWORD_SET returns False (0) if:

Arguments

Expression

The expression to be tested. Expression is usually a named variable.

Keywords

None.

Examples

Suppose that you are writing an IDL procedure that has the following procedure definition line:

PRO myproc, KEYW1 = keyw1, KEYW2 = keyw2

The following command could be used to execute a set of commands only if the keyword KEYW1 is set (i.e., it is present and nonzero):

IF KEYWORD_SET(keyw1) THEN BEGIN

The commands to be executed only if KEYW1 is set would follow.

Version History

Original

Introduced

See Also

ARG_PRESENT , LOGICAL_TRUE, N_ELEMENTS , N_PARAMS